#ifndef SMARTWIDGET_H
#define SMARTWIDGET_H

#include <QWidget>
#include <QPixmap>
#include <QPainter> // 画家类
#include <QPaintEvent> // 绘画事件类
#include <QPushButton>

#include "tcpserversingleton.h"

class SmartWidget : public QWidget
{
    Q_OBJECT
public:
    explicit SmartWidget(QWidget *parent = 0);

    // 控制灯泡的变量
    bool isShow1;
    bool isShow2;
    bool isShow3;
    bool isShow4;
    bool isShow5;
    bool isShow6;
    bool isShow7;

    // 控制空调的变量
    bool isOpen1;
    bool isOpen2;
    bool isOpen3;

    QPushButton *light_btn1;
    QPushButton *light_btn2;
    QPushButton *light_btn3;
    QPushButton *light_btn4;
    QPushButton *light_btn5;
    QPushButton *light_btn6;
    QPushButton *light_btn7;
    QPushButton *air_btn1;
    QPushButton *air_btn2;
    QPushButton *air_btn3;

    tcpServerSingleton *tcpServer;

    // override检查是否成功重写paintEvent
    void paintEvent(QPaintEvent *e) override;
    void resizeEvent(QResizeEvent *e) override;

signals:
    void sig_send(const QString &send_data);

public slots:
    void slot_update_status(const QString &num);
};

#endif // SMARTWIDGET_H
